using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace RFCReader
{
    public partial class CircleToolbar : Form
    {
        public CircleToolbar()
        {
            InitializeComponent();
        }

        private void CircleToolbar_Load(object sender, EventArgs e)
        {
            GraphicsPath path = new GraphicsPath();
            path.AddEllipse(0, 30, 40, 40);
            path.AddEllipse(60, 30, 40, 40);
            path.AddEllipse(30, 0, 40, 40);
            path.AddEllipse(30, 60, 40, 40);
            this.Region = new Region(path);
        }
        public Tools GetOpt()
        {
            return opt;
        }
        Tools opt = Tools.T_RIGHT;
        private void CircleToolbar_MouseLeave(object sender, EventArgs e)
        {
            
            Close();
        }
        private Tools GetOpt(int x, int y)
        {
            int a = y - x;
            int b = y + x - Height;
            if (a > 0 && b > 0) return Tools.T_XHX;
            else if (a < 0 && b < 0) return Tools.T_YGB;
            else if (a > 0 && b < 0) return Tools.T_LEFT;
            else if (a < 0 && b > 0) return Tools.T_RIGHT;

            return Tools.T_NONE;
            
        }
       

        private void CircleToolbar_MouseClick(object sender, MouseEventArgs e)
        {
            opt = GetOpt(e.X, e.Y);
            Close();
        }

        private void CircleToolbar_MouseMove(object sender, MouseEventArgs e)
        {
            opt = GetOpt(e.X, e.Y);
        }

        private void CircleToolbar_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                opt = Tools.T_NONE;
                this.Close();
            }
        }

       
    }
}